package com.itmck.product.control;

import com.itmck.product.dto.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * 太阳当空照,花儿对我笑
 * <p>
 * Create by M ChangKe 2021/11/2 12:53
 **/
@Slf4j
@RestController
public class ProductController {

    @Value(value = "${server.port}")
    private String port;

    @GetMapping("/product/getProduct")
    public String getProduct(@RequestParam String name) {
        log.info("请求参数:{}", name);
        return "product:" + port + "----------------" + name;
    }

    @GetMapping("/product2/getProduct2")
    public String getProduct2(@RequestParam String name) {
        log.info("请求参数:{}", name);
        return "product:" + port + "----------------" + name;
    }



    @PostMapping("/product1/getProductUser")
    public User getProductUser(@RequestBody User user) {
        log.info("请求参数:{}", user);
        user.setName("hello:"+user.getName());
        return user;
    }

}